3.782 \(\int (a+a \cos (c+d x))^n (-\frac{B n}{1+n}+B \cos (c+d x)) \, dx\)

Optimal. Leaf size=28 \[ \frac{B \sin (c+d x) (a \cos (c+d x)+a)^n}{d (n+1)} \]

[Out]

(B*(a + a*Cos[c + d*x])^n*Sin[c + d*x])/(d*(1 + n))

________________________________________________________________________________________

Rubi [A]  time = 0.0447429, antiderivative size = 28, normalized size of antiderivative = 1., number of steps used = 1, number of rules used = 1, integrand size = 31, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.032, Rules used = {2749} \[ \frac{B \sin (c+d x) (a \cos (c+d x)+a)^n}{d (n+1)} \]

Antiderivative was successfully verified.

[In]

Int[(a + a*Cos[c + d*x])^n*(-((B*n)/(1 + n)) + B*Cos[c + d*x]),x]

[Out]

(B*(a + a*Cos[c + d*x])^n*Sin[c + d*x])/(d*(1 + n))

Rule 2749

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> -Simp[(d*
Cos[e + f*x]*(a + b*Sin[e + f*x])^m)/(f*(m + 1)), x] /; FreeQ[{a, b, c, d, e, f, m}, x] && NeQ[b*c - a*d, 0] &
& EqQ[a^2 - b^2, 0] && EqQ[a*d*m + b*c*(m + 1), 0]

Rubi steps

\begin{align*} \int (a+a \cos (c+d x))^n \left (-\frac{B n}{1+n}+B \cos (c+d x)\right ) \, dx &=\frac{B (a+a \cos (c+d x))^n \sin (c+d x)}{d (1+n)}\\ \end{align*}

Mathematica [A]  time = 0.166431, size = 28, normalized size = 1. \[ \frac{B \sin (c+d x) (a (\cos (c+d x)+1))^n}{d (n+1)} \]

Antiderivative was successfully verified.

[In]

Integrate[(a + a*Cos[c + d*x])^n*(-((B*n)/(1 + n)) + B*Cos[c + d*x]),x]

[Out]

(B*(a*(1 + Cos[c + d*x]))^n*Sin[c + d*x])/(d*(1 + n))

________________________________________________________________________________________

Maple [B]  time = 0.418, size = 74, normalized size = 2.6 \begin{align*} 2\,{\frac{B\tan \left ( 1/2\,dx+c/2 \right ) }{d \left ( 1+n \right ) \left ( 1+ \left ( \tan \left ( 1/2\,dx+c/2 \right ) \right ) ^{2} \right ) }{{\rm e}^{n\ln \left ( a+{\frac{a \left ( 1- \left ( \tan \left ( 1/2\,dx+c/2 \right ) \right ) ^{2} \right ) }{1+ \left ( \tan \left ( 1/2\,dx+c/2 \right ) \right ) ^{2}}} \right ) }}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+cos(d*x+c)*a)^n*(-B*n/(1+n)+B*cos(d*x+c)),x)

[Out]

2*B/d/(1+n)*tan(1/2*d*x+1/2*c)*exp(n*ln(a+a*(1-tan(1/2*d*x+1/2*c)^2)/(1+tan(1/2*d*x+1/2*c)^2)))/(1+tan(1/2*d*x
+1/2*c)^2)

________________________________________________________________________________________

Maxima [B]  time = 2.17089, size = 193, normalized size = 6.89 \begin{align*} -\frac{{\left (\cos \left (d x + c\right )^{2} + \sin \left (d x + c\right )^{2} + 2 \, \cos \left (d x + c\right ) + 1\right )}^{n} B a^{n} \sin \left (-{\left (d x + c\right )}{\left (n + 1\right )} + 2 \, n \arctan \left (\sin \left (d x + c\right ), \cos \left (d x + c\right ) + 1\right )\right ) -{\left (\cos \left (d x + c\right )^{2} + \sin \left (d x + c\right )^{2} + 2 \, \cos \left (d x + c\right ) + 1\right )}^{n} B a^{n} \sin \left (-{\left (d x + c\right )}{\left (n - 1\right )} + 2 \, n \arctan \left (\sin \left (d x + c\right ), \cos \left (d x + c\right ) + 1\right )\right )}{2 \cdot 2^{n} d{\left (n + 1\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+a*cos(d*x+c))^n*(-B*n/(1+n)+B*cos(d*x+c)),x, algorithm="maxima")

[Out]

-1/2*((cos(d*x + c)^2 + sin(d*x + c)^2 + 2*cos(d*x + c) + 1)^n*B*a^n*sin(-(d*x + c)*(n + 1) + 2*n*arctan2(sin(
d*x + c), cos(d*x + c) + 1)) - (cos(d*x + c)^2 + sin(d*x + c)^2 + 2*cos(d*x + c) + 1)^n*B*a^n*sin(-(d*x + c)*(
n - 1) + 2*n*arctan2(sin(d*x + c), cos(d*x + c) + 1)))/(2^n*d*(n + 1))

________________________________________________________________________________________

Fricas [A]  time = 1.31158, size = 66, normalized size = 2.36 \begin{align*} \frac{{\left (a \cos \left (d x + c\right ) + a\right )}^{n} B \sin \left (d x + c\right )}{d n + d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+a*cos(d*x+c))^n*(-B*n/(1+n)+B*cos(d*x+c)),x, algorithm="fricas")

[Out]

(a*cos(d*x + c) + a)^n*B*sin(d*x + c)/(d*n + d)

________________________________________________________________________________________

Sympy [F(-1)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+a*cos(d*x+c))**n*(-B*n/(1+n)+B*cos(d*x+c)),x)

[Out]

Timed out

________________________________________________________________________________________

Giac [B]  time = 46.1419, size = 1850, normalized size = 66.07 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+a*cos(d*x+c))^n*(-B*n/(1+n)+B*cos(d*x+c)),x, algorithm="giac")

[Out]

-2*(B*(sqrt(-tan(d*x + c)^4*tan(1/2*d*x + 1/2*c)^4 + 2*tan(d*x + c)^4*tan(1/2*d*x + 1/2*c)^2 - tan(d*x + c)^2*
tan(1/2*d*x + 1/2*c)^4 + 3*tan(d*x + c)^4 + 6*tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 7*tan(d*x + c)^2 + 4*tan
(1/2*d*x + 1/2*c)^2 + 4)*abs(a)/(tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^2 + tan(d*x + c)^2 + tan(1/2*d*x + 1/2*c)
^2 + 1))^n*tan(-1/4*pi*n*sgn(4*a*tan(1/2*d*x + 1/2*c)^2 - 4*a)*sgn(a)*sgn(tan(1/2*d*x + 1/2*c)) + 1/4*pi*n*sgn
(tan(1/2*d*x + 1/2*c)^2 - 1)*sgn(tan(1/2*d*x + 1/2*c)) - 1/4*pi*n*sgn(a)*sgn(tan(1/2*d*x + 1/2*c)) + pi*n*floo
r(1/4*sgn(4*a*tan(1/2*d*x + 1/2*c)^2 - 4*a)*sgn(a)*sgn(tan(1/2*d*x + 1/2*c)) - 1/4*sgn(tan(1/2*d*x + 1/2*c)^2
- 1)*sgn(tan(1/2*d*x + 1/2*c)) + 1/4*sgn(a)*sgn(tan(1/2*d*x + 1/2*c)) - 1/4*sgn(tan(1/2*d*x + 1/2*c)) + 1/2) +
 1/4*pi*n*sgn(tan(1/2*d*x + 1/2*c)))^2*tan(1/2*d*x + 1/2*c) - B*(sqrt(-tan(d*x + c)^4*tan(1/2*d*x + 1/2*c)^4 +
 2*tan(d*x + c)^4*tan(1/2*d*x + 1/2*c)^2 - tan(d*x + c)^2*tan(1/2*d*x + 1/2*c)^4 + 3*tan(d*x + c)^4 + 6*tan(d*
x + c)^2*tan(1/2*d*x + 1/2*c)^2 + 7*tan(d*x + c)^2 + 4*tan(1/2*d*x + 1/2*c)^2 + 4)*abs(a)/(tan(d*x + c)^2*tan(
1/2*d*x + 1/2*c)^2 + tan(d*x + c)^2 + tan(1/2*d*x + 1/2*c)^2 + 1))^n*tan(1/2*d*x + 1/2*c))/(d*n*tan(-1/4*pi*n*
sgn(4*a*tan(1/2*d*x + 1/2*c)^2 - 4*a)*sgn(a)*sgn(tan(1/2*d*x + 1/2*c)) + 1/4*pi*n*sgn(tan(1/2*d*x + 1/2*c)^2 -
 1)*sgn(tan(1/2*d*x + 1/2*c)) - 1/4*pi*n*sgn(a)*sgn(tan(1/2*d*x + 1/2*c)) + pi*n*floor(1/4*sgn(4*a*tan(1/2*d*x
 + 1/2*c)^2 - 4*a)*sgn(a)*sgn(tan(1/2*d*x + 1/2*c)) - 1/4*sgn(tan(1/2*d*x + 1/2*c)^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